package com.loop.stringDemo;

/**
 * String类的判断地址相等和内容相等
 */
public class StringDemo2 {
    public static void main(String[] args) {
        String s = "HelloWord";
        System.out.println(s.charAt(3));

        System.out.println(s.substring(3));

        System.out.println(s.substring(1,4));
        for (int i = 0; i < s.length(); i++) {
            System.out.println(s.charAt(i));
        }

        System.out.println(s.indexOf("o"));
        System.out.println(s.indexOf("o",5));
        System.out.println(s.lastIndexOf("o"));

        String s1 = "abc";
        String s2 = "abc ".trim();
        System.out.println(s1.equals(s2));
        String s5 = "a"+"b"+"c";
        System.out.println(s1==s5);
    }
}
